{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改密码</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link" href="javascript:history.go(-1);">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal"  id="pwd-form">
                        <input type="hidden" value="{$data['id']}" name="id">
                        <!--表单项-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">登录名</label>
                            <div class="col-sm-10">
                                <p class="form-control-static">{$data['login_name']}</p>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">用户名</label>
                            <div class="col-sm-10">
                                <p class="form-control-static">{$data['user_name']}</p>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">原密码</label>
                            <div class="col-sm-10">
                                <input type="hidden"  name="oldPwdVal" value="{$data['pwd']}">
                                <input type="password" class="form-control" name="oldPwd" value=""  placeholder="输入原密码" id="oldPwd">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="pwd" value=""  placeholder="输入新密码" id="pwd">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">确认密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="pwd2" recheck="pwd" value=""  placeholder="输入确认密码" id="pwd2">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <!--/表单项-->
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="updatePwd()">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
{include file="public/footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    /**
     * 修改密码
     */
    function updatePwd() {
        //判空
        var oldPwd=$("#oldPwd").val();
        if(oldPwd==""){
            layer.msg('原密码不能为空！', {icon: 2});
            return;
        }
        var pwd=$("#pwd").val();
        if(pwd==""){
            layer.msg('新密码不能为空！', {icon: 2});
            return;
        }
        var pwd2=$("#pwd2").val();
        if(pwd2==""){
            layer.msg('确认密码不能为空！', {icon: 2});
            return;
        }
        $.ajax({
            url: "/admin/sys.user/updPwd",
            type: 'POST',
            dataType: 'json',
            data:$("#pwd-form").serializeJSON(),
            success: function (res) {
                if (res.rc == 0) {
                    layer.msg('修改成功！', {icon: 1});
                } else {
                    layer.msg('修改失败！', {icon: 2});
                }
            }
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
